package query_handler

import (
	"file-cleaner/internal/file_cleaner/file_info"
	"time"
)

func (a QueryByATimeImpl) doHandle(info *file_info.FileInfo) bool {
	tt := time.Unix(0, info.GetStat().LastAccessTime.Nanoseconds())
	return tt.After(a.AfterTime) && tt.Before(a.BeforeTime)
}

func (c QueryByCTimeImpl) doHandle(info *file_info.FileInfo) bool {
	tt := time.Unix(0, info.GetStat().CreationTime.Nanoseconds())
	return tt.After(c.AfterTime) && tt.Before(c.BeforeTime)
}

func (b QueryByMTimeImpl) doHandle(info *file_info.FileInfo) bool {
	tt := time.Unix(0, info.GetStat().LastWriteTime.Nanoseconds())
	return tt.After(b.AfterTime) && tt.Before(b.BeforeTime)
}
